//
//  NSDate+CLToString.m
//  CLBasicsDemo
//
//  Created by 小草毋正 on 2017/9/13.
//  Copyright © 2017年 zbw. All rights reserved.
//

#import "NSDate+CLToString.h"



@implementation NSDate (CLToString)

+ (NSString *)toStringFormate:(NSString *)formate {
    return [[NSDate date] toStringFormate:formate];
}

- (NSString *)toStringFormate:(NSString *)formate {
    NSDateFormatter* formatter = [NSDateFormatter formateWithString:formate];
    return [formatter stringFromDate:self];
}

+ (NSDate *)dateWithString:(NSString *)dateString formate:(NSString *)formate {
    NSDateFormatter* dateFormat = [NSDateFormatter formateWithString:formate];
    NSDate *date = [dateFormat dateFromString:dateString];
    return date;
}


@end


@implementation NSDateFormatter (CLForString)

+ (instancetype)formateWithString:(NSString *)stringFormate{
    NSDateFormatter* dateFormat = [[NSDateFormatter alloc] init];
    [dateFormat setDateFormat:stringFormate];
    return dateFormat;
}

@end





